<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="/admin/css/pintuer.css">
<link rel="stylesheet" href="/admin/css/admin.css">
<script src="/admin/js/jquery.js"></script>
<script src="/admin/js/pintuer.js"></script>
<script src="/admin/js/uploadPreview.js"></script>


   <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <script type="text/javascript" charset="utf-8" src="/admin/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/admin/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="../ueditor/lang/zh-cn/zh-cn.js"></script>

    <style type="text/css">
        div{
            width:100%;
        }
    </style>

</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加文章</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" action="{{url('admin_art/add')}}" enctype="multipart/form-data">  
    {!!csrf_field()!!}
      <div class="form-group">
        <div class="label">
          <label>文章标题：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="" name="art_title" data-validate="required:请输入文章名称" />
          <div class="tips"></div>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>文章作者：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" value="" name="art_author" data-validate="required:请输入文章作者" />
          <div class="tips"></div>
        </div>
      </div>
 
     

      <div class="form-group">
        <div class="label">
          <label>文章栏目：</label>
        </div>
        <div class="field">
          <select name="cat_id" class="input w50" data-validate="required:请选择栏目">
            <option value="">请选择栏目</option>
          
          @foreach($catlist as $list)
            <option value="{{$list->cat_id}}">
            @if($list->parentid == 0)
            ---
            @endif
              {{$list->cat_name}}
            </option>
          @endforeach
           

          </select>
        </div>
      </div>
      <ul id="warp">
 

     
    <div class="form-group">
        <div class="label" style="width:95px;">
        <br>
          <label>文章图片：</label>
        </div>
        <li>
        <div class="field" style="">
        <input type="file" id="up_img_WU_FILE_0" onchange="Javascript:validate_img(this);" name="art_img">
        </div>
        <br>
        <br>
        <img id="imgShow_WU_FILE_0" width="150" height="100">
        </li>

    </div> 
    </ul>
      <div class="form-group">
        <div class="label">
          <label>文章描述：</label>
        </div>
        <div class="field">
          <textarea class="input" name="art_intro" style=" height:90px;width: 60%" data-validate="required:请输入文章描述"></textarea>
          <div class="tips"></div>
        </div>
      </div>

      <div class="form-group">
        <div class="label">
          <label>文章内容：</label>
        </div>
        <div>
    <h1> &nbsp;</h1>
  
    <script id="editor1" type="text/plain" name="art_content" style="width:92%;height:300px;margin-left: 70px;" >
    </script>
    </div>
    <script type="text/javascript">

        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        var ue = UE.getEditor('editor1');
</script>
        <!-- <div class="field">
          <textarea class="input" name="content" style=" height:90px; resize: none;"></textarea>
          <div class="tips"></div>
        </div> -->
      </div>
     
      <div class="clear"></div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

</body>
  <script type="text/javascript"> 
  function validate_img(a){
    var file = a.value;
    if(!/.(gif|jpg|jpeg|png|GIF|JPG|png)$/.test(file)){
      alert("图片类型必须是.gif,jpeg,jpg,png中的一种");
      return false;
    }else{
       var image = new Image();
       image.src = file;
       var height = image.height;
       var width = image.width;
       var filesize = image.filesize;
       alert(height+"x.."+filesize);
       if(width>1115 && height>275 && filesize>102400){
         alert('请上传1115*275像素 或者大小小于100k的图片');
         return false;
       }
   }
   alert("图片通过");
  }
  </script> 
</html>